
angular.module('starter', ['ionic','starter.controllers','home.controllers', 
'musicList.controllers','starter.services','wjwuser.controllers','myMusic.controllers','searchCtrl.controllers',"MymusicList.controllers","audioCtrl.controllers"])
.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
  
    if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      
      StatusBar.styleDefault();
    }
  });
})

.config(function($stateProvider, $urlRouterProvider) {

  $stateProvider

    .state('tab', { 
    url: '/tab',
    abstract: true,
    templateUrl: 'templates/tabs.html',
    controller: 'audioCtrl'
  })

  .state('tab.home', { //主页路由
    url: '/home',
    views: {
      'tab-home': {
        templateUrl: 'templates/home.html',
        controller: 'HotCtrl'
      }
    }
  })
  
  .state('tab.search', { //主页路由
    url: '/home/search',
    views: {
      'tab-home': {
        templateUrl: 'templates/search.html',
        controller: 'searchCtrl'
      }
    }
  })

  .state('tab.myMusic', { //排行榜路由
      url: '/home/myMusic',
      views: {
        'tab-home': {
          templateUrl: 'templates/myMusic.html',
          controller: 'myMusicCtrl'
        }
      }
   })
  
    .state('tab.myMusicList', { //我的音乐路由
      url: '/myMusicList',
      views: {
        'tab-myMusicList': {
          templateUrl: 'templates/myMusicList.html',
          controller: 'MymusicListCtrl'
        }
      }
   })
  
    .state('tab.musicList', { //歌手歌单路由
      url: '/home/list/:mylist/:chatId',
      views: {
        'tab-home': {
          templateUrl: 'templates/musicList.html',
          controller: 'musicListCtrl'
        }
      }
    })

  .state('tab.friend', { //我的朋友路由
    url: '/friend',
    views: {
      'tab-friend': {
        templateUrl: 'templates/friend.html',
        controller: 'firendCtrl'
      }
    }
  })
  
  .state('tab.play', { //播放列表路由
    url: '/home/:chatId/:id',
    views: {
      'tab-home': {
        templateUrl: 'templates/play.html',
        controller: 'playCtrl'
      }
    }
  })
  
   .state('tab.user', { //我的账户路由
    url: '/user',
    views: {
      'tab-user': {
        templateUrl: 'templates/user.html',
        controller: 'userCtrl'
      }
    }
  });

  $urlRouterProvider.otherwise('/tab/home');

});
